import React from 'react';
import { Card, Modal, Button } from 'antd';
import PropTypes from 'prop-types';
import DescriptionList from '@/components/DescriptionList';
import { getDicByKey } from '@/support/common';

const { Description } = DescriptionList;
class dealerDetailModal extends React.PureComponent {
  static contextTypes = {
    dicData: PropTypes.any,
  };
  render() {
    const status = ['', '已销售', '车厂', '销售取消', '经销商'];
    const { changeVisible, detailModelData } = this.props;
    return (
      <Modal
        title="详细信息"
        style={{ top: 20 }}
        width="40%"
        visible={this.props.visible}
        onCancel={() => changeVisible()}
        footer={[
          <Button key="back" type="primary" size="default" onClick={() => changeVisible()}>
            返回
          </Button>,
        ]}
      >
        <div>
          <Card bordered={false} type="inner">
            <DescriptionList col={2}>
              <Description term="VIN号"style={{ width: '50%' }}>{detailModelData.vin}</Description>
              <Description term="品牌"style={{ width: '50%' }}>{getDicByKey(this.context.dicData, 'optBrand', detailModelData.brandId)}</Description>
              <Description term="车系"style={{ width: '50%' }}>{getDicByKey(this.context.dicData, 'vehicleSeries', detailModelData.seriesId)}</Description>
              <Description term="车型"style={{ width: '50%' }}>{getDicByKey(this.context.dicData, 'vehicleType', detailModelData.styleId)}</Description>
              <Description term="车辆状态"style={{ width: '50%' }}>{status[detailModelData.status] }</Description>
              <Description term="车牌"style={{ width: '50%' }}>{detailModelData.licence}</Description>
              <Description term="颜色"style={{ width: '50%' }}>{getDicByKey(this.context.dicData, 'vehicleColor', detailModelData.colorId)}</Description>
              <Description term="发动机号"style={{ width: '50%' }}>{detailModelData.doptCode}</Description>
              <Description term="经销商"style={{ width: '50%' }}>{getDicByKey(this.context.dicData, 'dealer', detailModelData.dealerId)}</Description>
              <Description term="SIM卡号"style={{ width: '50%' }}>{detailModelData.sim}</Description>
              <Description term="车机号"style={{ width: '50%' }}>{detailModelData.ipda}</Description>
              <Description term="T-BOX号"style={{ width: '50%' }}>{detailModelData.tbox}</Description>
            </DescriptionList>
          </Card>
        </div>
      </Modal>
    );
  }
}

export default dealerDetailModal;
